﻿using System.Reflection;
using System.Windows.Controls;

namespace XEvolve.Presentation.Extensions
{
    public static class ListBoxExtensions
    {
        public static void SetAnchorItem(this ListBox listBox, object item)
        {
            typeof(ListBox).GetProperty("AnchorItem", BindingFlags.NonPublic | BindingFlags.Instance).SetValue(listBox, item, null);
        }

        public static object GetAnchorItem(this ListBox listBox)
        {
            return typeof(ListBox).GetProperty("AnchorItem", BindingFlags.NonPublic | BindingFlags.Instance).GetValue(listBox, null);
        }
    }
}
